<template>
	<div style="padding:0px;">
		<el-card class="box-card">
		  <div slot="header" class="clearfix">
		    <span style="line-height: 30px;">查看车源</span>
		  </div>
		  <div  class="text item">
			<el-form :model="dialogForm" :label-width="formLabelWidth">
				<el-form-item label="发布人" >
			      <el-input v-model="dialogForm.releasePerson" auto-complete="off" disabled></el-input>
			    </el-form-item>
					<el-form-item label="经销商名称" >
			      <el-input v-model="dialogForm.dealerName" auto-complete="off" disabled></el-input>
			    </el-form-item>
						<el-form-item label="发布时间" >
			      <el-input :value="getDate(dialogForm.addDate)" auto-complete="off" disabled></el-input>
			    </el-form-item>
					<el-form-item label="车源状态" >
			      <el-input v-model="dialogForm.statusString " auto-complete="off" disabled></el-input>
			    </el-form-item>
			    <el-form-item label="汽车车型" >
			      <el-input v-model="dialogForm.carName " auto-complete="off" disabled></el-input>
			    </el-form-item>
			    <el-form-item label="外观颜色" >
			      <el-input v-model="dialogForm.color " auto-complete="off" disabled></el-input>
			    </el-form-item>
			    <el-form-item label="内饰颜色" >
			      <el-input v-model="dialogForm.interiorColor" auto-complete="off" disabled></el-input>
			    </el-form-item>
					<el-form-item label="汽车车规" >
			      <el-input v-model="dialogForm.carSpecificationName " auto-complete="off" disabled></el-input>
			    </el-form-item>
			 		<el-form-item label="期车\现车" >
			      <el-input v-model="dialogForm.carInStockString" auto-complete="off" disabled></el-input>
			    </el-form-item>
			    <el-form-item label="指导价(万元)" >
			      <el-input :value="dialogForm.guidancePrice |toWFixed4" auto-complete="off" disabled></el-input>
						 <span class="convertCurrency">{{dialogForm.guidancePrice |convertCurrency}}</span>
			    </el-form-item>
			    <el-form-item label="报价(万元)" >
			      <el-input :value="dialogForm.quotePrice|toWFixed4  " auto-complete="off" disabled></el-input>
						 <span class="convertCurrency">{{dialogForm.quotePrice |convertCurrency}}</span>
			    </el-form-item>
					 <el-form-item label="车源有效期" >
			      <el-input :value="dialogForm.duration+'天' " auto-complete="off" disabled></el-input>
			    </el-form-item>
					 <el-form-item label="到港时间" >
			      <el-input :value="getDate(dialogForm.arrivalTime) " auto-complete="off" disabled></el-input>
			    </el-form-item>
					<el-form-item label="手续情况" >
			      <el-input v-model="dialogForm.price" auto-complete="off" disabled></el-input>
			    </el-form-item>
					<el-form-item label="到店时间" >
			      <el-input :value="getDate(dialogForm.arrivalTime) " auto-complete="off" disabled></el-input>
			    </el-form-item>
					<el-form-item label="车源所在地" >
			      <el-input v-model="dialogForm.curLocation " auto-complete="off" disabled></el-input>
			    </el-form-item>
					<el-form-item label="销售区域" >
			      <el-input v-model="dialogForm.salesArea " auto-complete="off" disabled></el-input>
			    </el-form-item>
					<el-form-item label="配置" >
			      <el-input v-model="dialogForm.carConfig " auto-complete="off" disabled></el-input>
			    </el-form-item>
					 <el-form-item label="备注"  prop="remark">
			      <el-input type="textarea" :rows=3 v-model="dialogForm.remark " auto-complete="off" disabled></el-input>
			    </el-form-item>
			    <el-form-item label="图片信息" >
			       <qiniu :qiniuImage="qiniuImage"  :id="qiniuImage.id" :canDelete="false"></qiniu>
			    </el-form-item>
			  </el-form>
			</div>
		</el-card>
		<div style="text-align:right;margin-top:15px;">
			 <el-button @click="returnBack">返 回</el-button>
			 <el-button v-if='dialogForm.status!=1' @click='LowerFrame'>下架</el-button>
			 
		</div>
	</div>
</template>
<script>
import agentHttp from '@/utils/agentHttp.js'
import qiniu from '@/views/qiniu/upload';
import {timestampToTime} from '@/utils/index.js';
	export default{
		props:['dialogSendData','tableData'],
		components:{qiniu},
		created(){
			this.selectData();//修改    
		},
		data(){
			return{
				formLabelWidth:'170px',
				//弹窗或者查看页面信息
		        dialogForm:{
		        },
		         qiniuImage:{
			        	id:"qiniuImage", //图片预览的id   
			        	image_uri:[],    //图片上传的列表  只含有url地址
			      },
			}
		},methods:{
			returnBack(){
		        this.dialogSendData.dialogFormVisible=false;
		    },
		    selectData(){
		        agentHttp.get(`adminApi/admin/v_2.0/car_source/view/${this.dialogSendData.id}`).then((data)=>{	
		            if(data.success){
		            	this.dialogForm=data.data.view;
									this.dialogForm.picUrl?this.qiniuImage.image_uri= this.dialogForm.picUrl.split(',').notempty():"";
		            } 
		        }) 
				},
				getDate(time){
					return timestampToTime(time)
				},
				LowerFrame(){			//下架
						agentHttp.put(`adminApi/admin/v_2.0/car_source/down/${this.dialogSendData.id}`).then((data)=>{
											 this.dialogSendData.dialogFormVisible = false;
											this.$message.success(data.data||"下架成功");
											this.$emit('Refresh',null);
						} )
				},
				FormatFour(val){
					alert(333)
		    	this.dialogForm[val]=((this.dialogForm[val]||"")-0).toFixed(4);
          // this.registeredCapital = convertCurrency(((this.dialogForm[val]||"")-0).toFixed(4) ,'万');
		    },
		}
	}
</script>